com.highdeal.pnr.hci
Class Property

java.lang.Object
  extended by com.highdeal.pnr.hci.Property
All Implemented Interfaces:
XMLMarshallable

public class Property
extends java.lang.Object
implements XMLMarshallable

This Java class represents a custom property (string, number, or date) in a item.

See Also:
ChargeableItem

XML API for HCI

The XML APIs specify the following XSD fragment:

XSD Fragment

<xs:simpleType name="propertyType">
   <xs:restriction base="xs:string">
      <xs:enumeration value="string"/>
      <xs:enumeration value="number"/>
      <xs:enumeration value="date"/>
   </xs:restriction>
 </xs:simpleType>
  <xs:element name="p">
   <xs:complexType>
    <xs:attribute name="t" type="propertyType"/>
    <xs:attribute name="v" type="xs:string"/>
    <xs:attribute name="n" type="xs:string"/>
   </xs:complexType>
  </xs:element>


Field Summary
static int DATE
          Constant for the date Property type.
static int DATE_REF
          Constant for the +100 date Property type.
static int NUMBER
          Constant for the number Property type.
static int NUMBER_REF
          Constant for the +100 number Property type.
static int STRING
          Constant for the string Property type.
static int STRING_REF
          Constant for the +100 string Property type.
 
Constructor Summary
Property()
          Builds an empty property.
Property(java.lang.String name, int type, java.lang.Object value)
          Builds a chargeable item property.
 
Method Summary
 void addCharacterData(java.lang.String cData)
          Adds character data to the content element.
 void addChild(java.lang.String tagName, XMLMarshallable child)
          Adds a child to the object, the child representing the marshallable object which must be added to the element.
 Property duplicate()
          Returns a new clone instance of the property
 java.lang.String getName()
          Returns the name of the custom property.
 int getType()
          Returns the type of the custom property.
 java.lang.Object getValue()
          Returns the value of the property.
 void marshal(XMLOutputter output)
          Gives an XML representation of this object, including its children.
 void setAttributes(XMLAttributes atts)
          Sets the attributes of the XML representation of the element being processed.
 void setName(java.lang.String name)
          Sets the name of the custom property.
 void setType(int type)
          Sets the type of the property.
 void setValue(java.lang.Object val)
          Sets the value of the property.
 ComponentProperty toComponentProperty()
          Converts the Property to a ComponentProperty.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NUMBER

public static final int NUMBER
Constant for the number Property type.

See Also:
Constant Field Values

STRING

public static final int STRING
Constant for the string Property type.

See Also:
Constant Field Values

DATE

public static final int DATE
Constant for the date Property type.

See Also:
Constant Field Values

NUMBER_REF

public static final int NUMBER_REF
Constant for the +100 number Property type.

See Also:
Constant Field Values

STRING_REF

public static final int STRING_REF
Constant for the +100 string Property type.

See Also:
Constant Field Values

DATE_REF

public static final int DATE_REF
Constant for the +100 date Property type.

See Also:
Constant Field Values
Constructor Detail

Property

public Property()
Builds an empty property.


Property

public Property(java.lang.String name,
                int type,
                java.lang.Object value)
Builds a chargeable item property.

Parameters:
name - The name of the property (must be unique for a given hargeableItem). This name must be the same as the name which is declared into the associated PropertyDescriptionModel object.
type - The type of the property. This type must be the same as the type which is declared into the associated PropertyDescriptionModel object.
value - The value of the property. This value must be compatible with the declared type.
See Also:
STRING, NUMBER, DATE, STRING_REF, NUMBER_REF, DATE_REF
Method Detail

getName

public java.lang.String getName()
Returns the name of the custom property.

Returns:
The property name

setName

public void setName(java.lang.String name)
Sets the name of the custom property.

Parameters:
name - The name of the property of a chargeable item

getType

public int getType()
Returns the type of the custom property.

Returns:
The property type
See Also:
STRING, NUMBER, DATE, STRING_REF, NUMBER_REF, DATE_REF

setType

public void setType(int type)
Sets the type of the property.

Parameters:
type - The type of the property

getValue

public java.lang.Object getValue()
Returns the value of the property. According to the type, this value can be cast into:
  • java.math.BigDecimal for a NUMBER type.
  • java.util.Date for a DATE type.
  • java.lang.String for a STRING type.
  • Returns:
    The value of the property
    See Also:
    STRING, NUMBER, DATE, STRING_REF, NUMBER_REF, DATE_REF

    setValue

    public void setValue(java.lang.Object val)
    Sets the value of the property.

    Parameters:
    val - The value of the property
    See Also:
    getValue(), STRING, NUMBER, DATE, STRING_REF, NUMBER_REF, DATE_REF

    duplicate

    public Property duplicate()
    Returns a new clone instance of the property

    Returns:
    A new clone instance of the property

    addCharacterData

    public void addCharacterData(java.lang.String cData)
    Description copied from interface: XMLMarshallable
    Adds character data to the content element.

    Specified by:
    addCharacterData in interface XMLMarshallable
    Parameters:
    cData - The character data to be added

    setAttributes

    public void setAttributes(XMLAttributes atts)
    Description copied from interface: XMLMarshallable
    Sets the attributes of the XML representation of the element being processed.

    Specified by:
    setAttributes in interface XMLMarshallable
    Parameters:
    atts - The XML attributes of the current element

    toComponentProperty

    public ComponentProperty toComponentProperty()
    Converts the Property to a ComponentProperty.

    Returns:
    The ComponentProperty results from the conversion

    addChild

    public void addChild(java.lang.String tagName,
                         XMLMarshallable child)
    Description copied from interface: XMLMarshallable
    Adds a child to the object, the child representing the marshallable object which must be added to the element.

    Specified by:
    addChild in interface XMLMarshallable
    Parameters:
    tagName - The name of tag for the child
    child - The child to be added

    marshal

    public void marshal(XMLOutputter output)
    Description copied from interface: XMLMarshallable
    Gives an XML representation of this object, including its children.

    Specified by:
    marshal in interface XMLMarshallable
    Parameters:
    output - The XML output to marshal the object into

    Document Published: October 2015 (SAP CC 4.0 SP10 and Later)